Sketch in HDOP, PDOP, VDOP, COURSE, and Speed into GPX writer to pave the way
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 28 Jun 2005 20:55:32 +0000 (20:55 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 28 Jun 2005 20:55:32 +0000 (20:55 +0000)
for Vito work.

gpsbabel/defs.h
gpsbabel/gpx.c

index 8de80b592bbec6d3a54d481842eb91736d4a448c..fb8b2dabcb6b5b8543ad04b4bc4b52e0addf1980 100644 (file)
@@ -242,6 +242,15 @@ typedef struct {
         * nice enough to use exactly the same priority scheme.
         */
        int route_priority;
+
+       /* Optional dilution of precision:  positional, horizontal, veritcal.  
+        * 1 <= dop <= 50 
+        */ 
+       unsigned char hdop;             
+       unsigned char vdop;             
+       unsigned char pdop;             
+       signed short course;    /* Optional: degrees true */
+       signed int speed;       /* Optional: meters per second. */
        
        geocache_data gc_data;
        xml_tag *gpx_extras;
index 1f05085851ae9bcdae971a4a73506aacc10bcf42..4deb6a2b3d4089b1d63d44cc5cb4d5187d78a7da 100644 (file)
@@ -1139,6 +1139,25 @@ write_gpx_url(const waypoint *waypointp)
        }
 }
 
+/*
+ * Write optional accuracty information for a given (way|track|route)point
+ * to the output stream.  Done in one place since it's common for all three.
+ * Order counts.
+ */
+static void
+gpx_write_accuracy(const waypoint *waypointp)
+{
+       if (waypointp->hdop) {
+               fprintf(ofd, "  <hdop>%d</hdop>\n", waypointp->hdop);
+       }
+       if (waypointp->vdop) {
+               fprintf(ofd, "  <vdop>%d</vdop>\n", waypointp->vdop);
+       }
+       if (waypointp->pdop) {
+               fprintf(ofd, "  <pdop>%d</pdop>\n", waypointp->pdop);
+       }
+}
+
 static void
 gpx_waypt_pr(const waypoint *waypointp)
 {
@@ -1179,6 +1198,7 @@ gpx_waypt_pr(const waypoint *waypointp)
        write_gpx_url(waypointp);
 
        write_optional_xml_entity(ofd, "  ", "sym", waypointp->icon_descr);
+       gpx_write_accuracy(waypointp);
 
        fprint_xml_chain( waypointp->gpx_extras, waypointp );
        fprintf(ofd, "</wpt>\n");
@@ -1220,6 +1240,7 @@ gpx_track_disp(const waypoint *waypointp)
        write_optional_xml_entity(ofd, "  ", "desc", waypointp->notes);
        write_gpx_url(waypointp);
        write_optional_xml_entity(ofd, "  ", "sym", waypointp->icon_descr);
+       gpx_write_accuracy(waypointp);
        fprintf(ofd, "</trkpt>\n");
 }
 
@@ -1265,6 +1286,7 @@ gpx_route_disp(const waypoint *waypointp)
        write_optional_xml_entity(ofd, "    ", "cmt", waypointp->description);
        write_optional_xml_entity(ofd, "    ", "desc", waypointp->notes);
        write_optional_xml_entity(ofd, "    ", "sym", waypointp->icon_descr);
+       gpx_write_accuracy(waypointp);
        fprintf(ofd, "  </rtept>\n");
 }